package com.jk.admin.controller;

import com.jk.admin.entity.Coupon;
import com.jk.admin.entity.Discount;
import com.jk.admin.entity.Product;
import com.jk.admin.service.DiscountSerivce;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
public class DiscountController {


    @Autowired
    private DiscountSerivce discountSerivce;

    @RequestMapping("getListDis")
    @ResponseBody
    public List<Coupon> getListDis(Coupon discount){
        return discountSerivce.getListDis(discount);
    }

    @RequestMapping("delDis")
    @ResponseBody
    public String delDis(String id){
        discountSerivce.delDis(id);
        return "";
    }

    @RequestMapping("updDis")
    @ResponseBody
    public String updDis(Coupon discount){
        discountSerivce.updDis(discount);
        return "";
    }

    @RequestMapping("getDisById")
    @ResponseBody
    public Coupon getDisById(String id){
        return discountSerivce.huiDis(id);
    }

    @RequestMapping("addDis")
    public String addDis(Coupon discount){
        discountSerivce.addDis(discount);
        return "";
    }


















    @RequestMapping("ToDiscountShow")
    public String ToDiscountShow(){
        return  "discount";
    }
}
